package com.example.wanshengtv;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleOwner;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;

import com.hjq.http.listener.OnHttpListener;

public class MenuActivity  extends Activity implements LifecycleOwner, OnHttpListener {

    private Button yunying;
    private Button shengchan;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menu);
        yunying = findViewById(R.id.yunying);
        shengchan = findViewById(R.id.shengchan);
        yunying.setOnKeyListener(new View.OnKeyListener() {
            @Override
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER){
                    Intent intent = new Intent(MenuActivity.this,YunYingActivity.class);
                    startActivity(intent);
                    return true;
                }
                return false;
            }
        });

        shengchan.setOnKeyListener(new View.OnKeyListener() {
            @Override
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER){
                    Intent intent = new Intent(MenuActivity.this,MainActivity.class);
                    startActivity(intent);
                    return true;
                }
                return false;
            }
        });
        yunying.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MenuActivity.this,MainActivity.class);
                startActivity(intent);
            }
        });
    }

    @NonNull
    @Override
    public Lifecycle getLifecycle() {
        return null;
    }

    @Override
    public void onSucceed(Object result) {

    }

    @Override
    public void onFail(Exception e) {

    }
}
